{# **
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://devdocs.prestashop.com/ for more information.
 *
 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 * #}
{% extends '@PrestaShop/Admin/TwigTemplateForm/prestashop_ui_kit_base.html.twig' %}

{% block combination_images_choice_widget %}
  {%- set attr = attr|merge({class: (attr.class|default('') ~ ' combination-images-selector')|trim}) -%}
  <div {{ block('widget_container_attributes') }}>
    {%- for child in form %}
      <label class="combination-image-choice{% if child.vars.checked %} selected{% endif %}">
        <img src="{{ child.vars.attr['data-image-url'] }}" />
        {{- form_widget(child, {
          parent_label_class: label_attr.class|default(''),
          translation_domain: choice_translation_domain,
        }) -}}
      </label>
    {% endfor -%}
  </div>
{% endblock %}

{%- block combination_manager_widget -%}
  <div {{ block('widget_attributes') }}>
    {# Preloader for first page load #}
    {{ include('@PrestaShop/Admin/Sell/Catalog/Product/Combination/loading_state.html.twig') }}

    {# Empty state when product has no combinations #}
    {{ include('@PrestaShop/Admin/Sell/Catalog/Product/Combination/empty_state.html.twig') }}

    {# Combination generator in a modal #}
    <div id="product_combinations_generator"
         data-is-multi-store-active="{{ isMultiStoreActive }}"
         data-translations="{{ {
           'generator.open': 'Open combinations generator'|trans({}, 'Admin.Catalog.Feature'),
           'generator.success': 'Successfully generated {combinationsNb} combinations.'|trans({}, 'Admin.Catalog.Feature'),
           'generator.action': 'Generate combinations|Generate combination|Generate {combinationsNb} combinations'|trans({}, 'Admin.Catalog.Feature'),
           'generator.select-all': 'Select all values ({valuesNb})'|trans({}, 'Admin.Catalog.Feature'),
           'search.placeholder': 'Search for attributes...'|trans({}, 'Admin.Catalog.Feature'),
           'modal.title': 'Generate combinations'|trans({}, 'Admin.Catalog.Feature'),
           'modal.close': 'Cancel'|trans({}, 'Admin.Actions'),
           'label.apply-to-all-shops': 'Generate combinations for all stores'|trans({}, 'Admin.Global'),
         }|json_encode }}"
    ></div>

    {{ render(controller('PrestaShopBundle\\Controller\\Admin\\Sell\\Catalog\\Product\\CombinationController::paginatedListAction', {
      productId: productId,
    })) }}
  </div>
{% endblock %}
